<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>我的优惠券</title>
		<meta id="viewport" name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0" />
    <meta name="format-detection" content="telephone=no" />
    <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"/>
    <link rel="stylesheet" type="text/css" href="css/aui.css"/>
    <style type="text/css">
    	body,html{
				background-color: rgb(240,240,240);
			}
    </style>
	</head>
	<body>
		<div id="content"></div>
	</body>
	<script id="coupon_item" type="text/html">
	{{each couponArr}}
		<div onclick="goTOHome()" style="width: 90%; margin-left: 5%; margin-top: 1rem; height: 10rem; background-color: white;">
			<div style="float: left;">
				<p style="padding-left: 2.0rem; padding-top: 1.0rem; height: 2.5rem; font-size: 2.5rem; color: red;">{{$value.price}}<span style="font-size: 1.3rem;">元</span></p>
				<p style="padding-left: 2.0rem; padding-top: 2.5rem; height: 1.3rem; font-size: 1.3rem; color: #999999;">有效期至：{{$value.gmtCreated}}</p>
				{{if !$value.priceSub}}
				<p style="padding-left: 2.0rem; padding-top: 2.0rem; height: 1.3rem; font-size: 1.3rem; color: #999999;">无门槛使用</p>
				{{else}}
				<p style="padding-left: 2.0rem; padding-top: 2.0rem; height: 1.3rem; font-size: 1.3rem; color: #999999;">满{{$value.priceSub}}减{{$value.price}}元</p>
				{{/if}}
			</div>
			<div align="center" style="margin-top: 3.2rem; margin-right: 2.0rem; width: 7.5rem; height: 3.6rem; line-height: 3.6rem; float: right; background-color: white; border: 1px solid red; border-radius: 1.8rem; color: red; font-size: 1.3rem;">立即使用</div>
		</div>
	{{/each}}
</script>
<script src="js/aui-toast.js" type="text/javascript" charset="utf-8"></script>
<script src="js/zepto.js" type="text/javascript" charset="utf-8"></script>
<script src="js/md5.js" type="text/javascript" charset="utf-8"></script>
<script src="js/art-template.js" type="text/javascript" charset="utf-8"></script>
<script src="js/wxrem.js" type="text/javascript" charset="utf-8"></script>
<!--<script src="//s.url.cn/qqun/qun/qqweb/m/qun/confession/js/vconsole.min.js"></script>-->
<script src="js/common.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
	var couponArr = new Array();
	function getMyCoupon(){
		$.ajax({
		type:"get",
		url: ascli(hostUrl+"order/user/coupon?token=" + token),
		async:true,
		success:function(data){
			if (!data.data) {
				return;
			}
			for (var i = 0; i < data.data.length; i ++) {
				if (data.data[i].status == 0) {
					couponArr.push(data.data[i]);
				}
			}
			data.couponArr = couponArr;
			var content = template("coupon_item", data);
			document.getElementById('content').innerHTML = content;
		}
	});
	}
	getToken(getMyCoupon);
	
	function goTOHome() {
		window.location.href = "index.html";
	}
	
</script>
</html>
